/*
 * Copyright (C) 2010,2011  Paulo Cesar Pereira de Andrade.
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Authors:
 *	Paulo Cesar Pereira de Andrade
 */

#ifndef _edfa_h
#define _edfa_h

#include "etypes.h"

/*
 * Types
 */
enum {
    dfa_ne,
    dfa_lt,
    dfa_le,
    dfa_eq,
    dfa_ge,
    dfa_gt,
};

struct edfa_rule {
    /* match eentry_t fields */
    edfa_rule_t		*next;
    esymbol_t		*value;
    eobject_t		 name;		/* east_node_t or esymbol object */
    eint32_t		 key;
    /* actual edfa_rules_t fields */
    union {
	struct {
	    euint32_t	 lt	: 1;
	    euint32_t	 eq	: 1;
	    euint32_t	 gt	: 1;
	} bits;
	eint32_t	 word;
    } data;
    eint32_t		 bit;		/* offset in vector of symbols
					 * referenced in the function */
};

/*
 * Prototypes
 */
extern void
edfa(efunction_t *function);

extern void
init_dfa(void);

extern void
finish_dfa(void);

#endif /* _edfa_h */
